import { ref } from 'vue'

export const searchFormRules = ref([
    {
        type: 'input',
        props: {
            label: '项目名称',
            prop: 'name',
            placeholder: '请输入项目名称',
        },
    },
    {
        type: 'input',
        props: {
            label: '场地名称',
            prop: 'placeName',
            placeholder: '请输入场地名称',
        },
    },
    {
        type: 'input',
        props: {
            label: '场地名称',
            prop: 'name',
            placeholder: '请输入场地名称',
        },
    },
])

export const tableHead = [
    {
        type: 'index',
        label: '序号',
    },
    {
        label: '项目名称',
        prop: 'name',
    },
    {
        label: '场地名称',
        prop: 'placeName',
    },
    {
        type: 'date',
        label: '创建时间',
        prop: 'createdAt',
    },
    {
        type: 'actionBar',
        label: '操作',
        data: [
            {
                text: '删除',
                props: {
                    icon: 'Delete',
                },
            },
        ],
    },
]

export const formRules = ref([
    {
        type: 'input',
        props: {
            label: '项目名称',
            prop: 'name',
            rules: [
                { required: true, message: '请填写项目名称', trigger: 'blur' },
                { min: 1, max: 100, message: '1 到 30个字符', trigger: 'blur' },
            ],
        },
        labelProps: {
            placeholder: '请输入项目名称',
        },
        col: {
            span: 12,
        },
    },
    {
        type: 'slot',
        slotName: 'inputNum',
        props: {
            label: '排序',
            prop: 'sort',
        },
        col: {
            span: 12,
        },
    },
    {
        type: 'select',
        props: {
            label: '所属场地',
            prop: 'placeId',
            validity: [
                {
                    required: true,
                    message: '请选择所属场地',
                    trigger: 'change',
                },
            ],
        },
        options: [],
        col: {
            span: 12,
        },
    },
    {
        type: 'input',
        props: {
            label: '项目描述',
            prop: 'description',
            rules: [
                { required: false, message: '请填写项目描述', trigger: 'blur' },
                { min: 1, max: 100, message: '1 到 500个字符', trigger: 'blur' },
            ],
        },
        labelProps: {
            placeholder: '请输入内容',
            type: 'textarea',
            rows: 4,
        },
        col: {
            span: 24,
        },
    },
])
